
//
//  BFTabBarController.m
//  beifang
//
//  Created by Apple on 17/4/12.
//  Copyright © 2017年 郭凯. All rights reserved.
//

#import "BFTabBarController.h"
#import "BFHomeController.h"
#import "BFCenterController.h"
#import "BFMessageController.h"
#import "BFNewsController.h"
#import "BFNavigationController.h"

@interface BFTabBarController ()

@end

@implementation BFTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    //首页
    BFHomeController *homeVc = [[BFHomeController alloc]init];
    BFNavigationController *homeNv = [[BFNavigationController alloc]initWithRootViewController:homeVc];
    UIImage *homeNorImage = [UIImage imageNamed:@"tabbar_home"];
    UIImage *homeSelImage = [[UIImage imageNamed:@"tabbar_home_selected"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    homeNv.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"新闻资讯" image:homeNorImage selectedImage:homeSelImage];
    [self addChildViewController:homeNv];

    //用户中心
    BFCenterController *centerVc = [[BFCenterController alloc]init];
    BFNavigationController *centerNv = [[BFNavigationController alloc]initWithRootViewController:centerVc];
    UIImage *centerNorImage = [UIImage imageNamed:@"tabbar_profile"];
    UIImage *centerSelImage = [[UIImage imageNamed:@"tabbar_profile_selected"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    centerNv.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"用户中心" image:centerNorImage selectedImage:centerSelImage];
    [self addChildViewController:centerNv];
   
    //消息
    BFMessageController *messVc = [[BFMessageController alloc]init];
    BFNavigationController *messNv = [[BFNavigationController alloc]initWithRootViewController:messVc];
    UIImage *messNorImage = [UIImage imageNamed:@"tabbar_message_center"];
    UIImage *messSelImage = [[UIImage imageNamed:@"tabbar_message_center_selected"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];;
    messNv.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"新闻资讯" image:messNorImage selectedImage:messSelImage];
    [self addChildViewController:messNv];
    
    //新闻资讯
    BFNewsController *newsVc = [[BFNewsController alloc]init];
    BFNavigationController *newsNv = [[BFNavigationController alloc]initWithRootViewController:newsVc];
    UIImage *newsNorImage = [UIImage imageNamed:@"tabbar_discover"];
    UIImage *newsSelImage = [[UIImage imageNamed:@"tabbar_discover_selected"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    newsNv.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"新闻资讯" image:newsNorImage selectedImage:newsSelImage];
    NSDictionary *dic = @{NSForegroundColorAttributeName:[UIColor orangeColor]};
    [[UITabBarItem appearance]setTitleTextAttributes:dic forState:UIControlStateSelected];
    [self addChildViewController:newsNv];
    
//    self.viewControllers = @[homeNv,centerNv,messNv,newsNv];
}
@end
